package com.xidian.zhiancloud.service.exam.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.xidian.zhiancloud.dao.exam.TrainPlanUserMapper;
import com.xidian.zhiancloud.model.exam.TrainPlanUser;
import com.xidian.zhiancloud.model.exam.UserDoc;
import com.xidian.zhiancloud.service.exam.ITrainPlanUserService;

/**
 * 培训计划用户Service业务层处理
 * 
 * @author zhouweitao
 * @date 2021-03-16
 */
@Service
public class TrainPlanUserServiceImpl implements ITrainPlanUserService 
{
    @Autowired
    private TrainPlanUserMapper trainPlanUserMapper;

    /**
     * 查询培训计划用户
     * 
     * @param id 培训计划用户ID
     * @return 培训计划用户
     */
    @Override
    public TrainPlanUser selectTrainPlanUserById(Long id)
    {
        return trainPlanUserMapper.selectTrainPlanUserById(id);
    }

    /**
     * 查询培训计划用户列表
     * 
     * @param trainPlanUser 培训计划用户
     * @return 培训计划用户
     */
    @Override
    public Page<TrainPlanUser> selectTrainPlanUserList(TrainPlanUser trainPlanUser)
    {
    	PageHelper.startPage(trainPlanUser.getPageNum()-1, trainPlanUser.getPageSize());
        return trainPlanUserMapper.selectTrainPlanUserList(trainPlanUser);
    }

    /**
     * 新增培训计划用户
     * 
     * @param trainPlanUser 培训计划用户
     * @return 结果
     */
    @Override
    public int insertTrainPlanUser(TrainPlanUser trainPlanUser)
    {
        return trainPlanUserMapper.insertTrainPlanUser(trainPlanUser);
    }

    /**
     * 修改培训计划用户
     * 
     * @param trainPlanUser 培训计划用户
     * @return 结果
     */
    @Override
    public int updateTrainPlanUser(TrainPlanUser trainPlanUser)
    {
        return trainPlanUserMapper.updateTrainPlanUser(trainPlanUser);
    }

    /**
     * 批量删除培训计划用户
     * 
     * @param ids 需要删除的培训计划用户ID
     * @return 结果
     */
    @Override
    public int deleteTrainPlanUserByIds(Long[] ids)
    {
        return trainPlanUserMapper.deleteTrainPlanUserByIds(ids);
    }

    /**
     * 删除培训计划用户信息
     * 
     * @param id 培训计划用户ID
     * @return 结果
     */
    @Override
    public int deleteTrainPlanUserById(Long id)
    {
        return trainPlanUserMapper.deleteTrainPlanUserById(id);
    }

	@Override
	public Page<UserDoc> selectUserDocList(UserDoc doc) {
		// TODO Auto-generated method stub
		PageHelper.startPage(doc.getPageNum()-1, doc.getPageSize());
		return trainPlanUserMapper.selectUserDocList(doc);
	}
}
